Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target py310 and modernize codebase with ruff #23401

Merged
merged 7 commits into from
Jan 17, 2025

Conversation

justinchuby
Copy link
Contributor

@justinchuby justinchuby commented Jan 16, 2025

Change target-version = "py310" and modernize the code base with ruff.

@@ -2661,7 +2661,7 @@
return attention_mask


def test_gpt_model(args: argparse.Namespace, sentences: Optional[List[str]] = None, is_greedy: bool = False):
def test_gpt_model(args: argparse.Namespace, sentences: list[str] | None = None, is_greedy: bool = False):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@@ -3061,7 +3061,7 @@
return output


def main(argv: Optional[List[str]] = None, sentences: Optional[List[str]] = None):
def main(argv: list[str] | None = None, sentences: list[str] | None = None):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@@ -29,7 +28,7 @@
if self.fuse_4(tanh_node, input_name_to_nodes, output_name_to_node):
return

def fuse_1(self, tanh_node, input_name_to_nodes, output_name_to_node) -> Optional[bool]:
def fuse_1(self, tanh_node, input_name_to_nodes, output_name_to_node) -> bool | None:

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@@ -137,7 +136,7 @@
self.node_name_to_graph_name[fused_node.name] = self.this_graph_name
return True

def fuse_2(self, tanh_node, input_name_to_nodes: Dict, output_name_to_node: Dict) -> Optional[bool]:
def fuse_2(self, tanh_node, input_name_to_nodes: dict, output_name_to_node: dict) -> bool | None:

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@@ -246,7 +245,7 @@
self.node_name_to_graph_name[fused_node.name] = self.this_graph_name
return True

def fuse_3(self, tanh_node, input_name_to_nodes: Dict, output_name_to_node: Dict) -> Optional[bool]:
def fuse_3(self, tanh_node, input_name_to_nodes: dict, output_name_to_node: dict) -> bool | None:

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
if self.fuse_1(erf_node, input_name_to_nodes, output_name_to_node):
return
if self.fuse_2(erf_node, input_name_to_nodes, output_name_to_node):
return
self.fuse_3(erf_node, input_name_to_nodes, output_name_to_node)

def fuse_1(self, erf_node, input_name_to_nodes: Dict, output_name_to_node: Dict) -> Optional[bool]:
def fuse_1(self, erf_node, input_name_to_nodes: dict, output_name_to_node: dict) -> bool | None:

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@@ -107,7 +106,7 @@
self.increase_counter("Gelu")
return True

def fuse_2(self, erf_node, input_name_to_nodes: Dict, output_name_to_node: Dict) -> Optional[bool]:
def fuse_2(self, erf_node, input_name_to_nodes: dict, output_name_to_node: dict) -> bool | None:

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@@ -184,7 +183,7 @@
self.increase_counter("Gelu")
return True

def fuse_3(self, erf_node, input_name_to_nodes: Dict, output_name_to_node: Dict) -> Optional[bool]:
def fuse_3(self, erf_node, input_name_to_nodes: dict, output_name_to_node: dict) -> bool | None:

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@justinchuby justinchuby requested a review from snnn January 16, 2025 23:35
@justinchuby justinchuby merged commit 09c4cc7 into main Jan 17, 2025
97 of 98 checks passed
@justinchuby justinchuby deleted the justinchu/ruff-pyversion branch January 17, 2025 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants